﻿using System;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace WebPattern.Core.Validators.Attributes
{
    class NotNullOrNotWhiteSpaceAttribute : ValueValidatorAttribute
    {
        public string MessageTemplate { set; get; }

        public NotNullOrNotWhiteSpaceAttribute(string messageTemplate)
        {
            this.MessageTemplate = messageTemplate;
        }

        protected override Validator DoCreateValidator(Type targetType)
        {
            return new NotNullOrNotWhiteSpaceValidator(MessageTemplate);
        }
    }
}
